<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:fo="http://www.w3.org/1999/XSL/Format"
			 xmlns:jfor="http://www.jfor.org/xmlns/2001/stylesheet"
			 >
  
  <xsl:output method="xml"
              version="1.0"
              encoding="utf-8"
              indent="yes"/>

    <jfor:stylesheet default="Normal">
        <jfor:style name="Normal" font-family="Times"/>
    </jfor:stylesheet>
		    
<xsl:template match="@*|node()">											<!--		This copies all the document and it's attributes, remember that -->
  <xsl:copy>																			<!--  	Remember that attributes are not copied by default without an "@*" -->
	<xsl:attribute name="jfor-class">Normal</xsl:attribute>			<!--  	Add a jfor-style sheet to everything in the document, so we can hope for consistancy -->
    <xsl:apply-templates  select="@*|node()"/>							<!--  	that and inherit-attributes.xsl -->
  </xsl:copy>
</xsl:template>


<xsl:template match="@start-indent" />							<!--  									-->
<xsl:template match="@space-after" />							<!--  	remove all tabbing and format 	-->
<xsl:template match="@space-after.conditionality" />		<!--  	since it wont work well in RTF	-->

<xsl:template match="@font-size">									<!--		jfor will crash if the 'small/medium/etc' font sizes are used-->
	<xsl:choose>																
		<xsl:when test=". = 'small'">									<!--		currently hardwired {10pt => small} 	-->
			<xsl:attribute name="font-size">10pt</xsl:attribute>  
		</xsl:when>
		<xsl:otherwise>														<!--		if not 'small/medium/etc' then the current size gets copy -->
			<xsl:attribute name="font-size"><xsl:value-of select="." /></xsl:attribute>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>
		    
<!--
<xsl:template match="*[@class/@id = 'XXXX']">	//Match the id or class from the xhtml tree
<xsl:element name="{name()}">						//Create a duplicate element matching the original element that
													//will have our fop-style attributes
	<xsl:attribute name="YYYY">ZZZZ</xsl:attribute>		//See fo:block/fo:inline specifications for possible style attributes,
															//Be aware that fo:inline can not be moved relative to their block (!=css)
	<xsl:apply-templates select="@*|node()"/>		//Cycle through and copy all attributes from original element (so as not to lose
													//element tags for future processing, then copy subnodes etc.
</xsl:element>										//Close completed copy of original element, but with new style attributes.
</xsl:template>
-->

<!-- LatinLine-Table section -->
<xsl:template match="*[@class='lg_block_table']">
	<xsl:element name="{name()}">
		<xsl:apply-templates select="@*|node()" />
	</xsl:element>																									<!-- The section above echos out the attributes/content of lg_blocks	-->
	<xsl:call-template name="make-space" /><!-- this line adds an extra line before notes-heading for readability.	-->
</xsl:template>
<!--	++++++++++	-->

<!-- Definition-Table section -->
	<!-- 
	These two lines remove the columns added into the definition table in order to get the pdf form to indent
	properly. Probably another solution should be found by writing the fo-formatting-pdf.xsl to add the columns 
	instead of adding them in with the fo-formatting.xsl, -Drew 
	-->
<xsl:template match="fo:table-column[@id='definitions_left_margin']" />
<xsl:template match="fo:table-column[@id='definitions_right_margin']" />
<!--	++++++++++	-->

<!-- Note-Table section -->
<xsl:template match="*[@id='notes_heading']">
		<xsl:call-template name="make-space" /><!-- this line adds an extra line before notes-heading for readability.	-->
	<xsl:element name="{name()}">
		<xsl:apply-templates select="@*|node()" />
	</xsl:element>
</xsl:template>

<xsl:template match="*[@id='notes']">				<!-- This removes an extra fo:block from the xml generated by fo-formatting.xsl that jfor -->
	<xsl:apply-templates select="@*|node()" />		<!-- mistakes as meaning an extra new-line. -->
</xsl:template>
<!--	++++++++++	-->

<xsl:template name="make-space">
<fo:block jfor-class="Normal" role="br" class="extra-space">&#160;</fo:block>
</xsl:template>

</xsl:stylesheet>